package com.lingkang.flychat.config;

import com.lingkang.flychat.interceptor.UserInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author linke
 * @date 2020/3/29 14:26
 * @description
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Autowired
    private UserInterceptor userInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //拦截验证所有user/**操作
        registry.addInterceptor(userInterceptor).addPathPatterns("/user/**");

    }
}
